<?php
$login = array(
    'name'      => 'login',
    'id'        => 'login',
    'value'     => set_value('login'),
    'maxlength' => 80,
    'size'      => 30,
    'class'     => 'form-control',
    'id'        => 'input_username',
);
if ($login_by_username AND $login_by_email) {
    $login_label = 'Email or login';
} else if ($login_by_username) {
    $login_label = 'Login';
} else {
    $login_label = 'Email';
}
$password = array(
    'name'  => 'password',
    'id'    => 'password',
    'size'  => 30,
    'class' => 'form-control',
    'id'    => 'input_password',
);
$remember = array(
    'name'    => 'remember',
    'id'      => 'remember',
    'value'   => 1,
    'checked' => set_value('remember'),
    'style'   => 'margin:0;padding:0',
);
$captcha  = array(
    'name'      => 'captcha',
    'id'        => 'captcha',
    'maxlength' => 8,
);
?>
<div class="alert alert-info"><span class="glyphicon glyphicon-info-sign"></span> Not registered yet? <a class="alert-link" href="#">Sign up</a>.</div>
<div class="row">
    <div class="col-xs-12 col-md-4 col-md-offset-4 form-group" id="login-frame">
        <?php echo form_open('auth/login', 'class="form-inline" role="form"'); ?>

        <div class="form-group has-error has-feedback">
            <label class="control-label" for="input_username">Username not found.</label>
            <div class="col-md-12 input-group">
                <span class="input-group-addon login-label">Username</span>
                <?php echo form_input($login); ?>
                <span class="glyphicon glyphicon-remove form-control-feedback"></span>
            </div> 
        </div>

        <div class="form-group has-success has-feedback">
            <div class="col-md-12 input-group">
                <span class="input-group-addon login-label">Password</span>
                <?php echo form_password($password); ?>
                <span class="glyphicon glyphicon-ok form-control-feedback"></span>
            </div>
        </div>
        <br><br>
        <div class="form-group">
             <div class="col-md-12 input-group">  
                <span class="input-group-addon"><?php echo form_checkbox($remember); ?></span>
                <label class="form-control text-left">Remember me</label>   
                <span class="input-group-btn">
                    <?php echo form_submit('submit', 'Login', 'class="btn btn-success"'); ?>
                </span>
            </div>
        </div>
        
    </div>
</div>

<?php
echo form_error($login['name']); 
echo isset($errors[$login['name']]) ? $errors[$login['name']] : '';
echo form_error($password['name']);
echo isset($errors[$password['name']]) ? $errors[$password['name']] : '';
?>